/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Project: mp2022 - WebApp
 * <p>Powered by webrx On 2022-04-16 09:12:00
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@SpringBootApplication @RestController @MapperScan("cn.webrx.mapper")
public class WebApp implements ApplicationRunner {
    @Value("${server.port:8080}")
    int port;
    public static void main(String[] args) {
        SpringApplication.run(WebApp.class,args);
    }

    @RequestMapping
    public String index(){
        return String.format("中文效果 - SprintBoot %s", SpringBootVersion.getVersion());
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        try{
            Runtime.getRuntime().exec("cmd /k start http://localhost:"+port);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}
